<!-- 主机，排风烟机等第一个页签的列表 -->
<template>
  <div class="item-info">
    <div id="info-strip" :class="itemData.leftClass"/>
    <div class="info-left">
      <ul>
        <li v-if="itemData.active === ''" class="link name"><i :style="{backgroundImage:'url(' + link + ')'}"/>{{ itemData.mname }}</li>
        <li v-else :title="itemData.mname" class="breakLink name"><i :style="{backgroundImage:'url(' + breakLink + ')'}"/>{{ itemData.mname }}</li>
        <li :title="itemData.position" class="position"><i :style="{backgroundImage:'url(' + position + ')'}"/>{{ itemData.position }}</li>
        <li :title="itemData.addr" class="firePumpHouse"><i :style="{backgroundImage:'url(' + firePumpHouse + ')'}"/>{{ itemData.park_name }} - {{ itemData.building_name }}</li>
        <li class="time"><i :style="{backgroundImage:'url(' + time + ')'}"/>{{ itemData.lastTime }}</li>
      </ul>
    </div>
    <div class="info-right">
      <ul>
        <li v-for="item in itemData.list" :key="item.index"><i :class="item.active"/>{{ item.name }}</li>
      </ul>
    </div>
    <ul v-if="itemData.otherInfo" class="other-info">
      <li @click="showInfo('火警点位')"><span>火警点位 </span><span> {{ itemData.firePoint }}</span></li>
      <li @click="showInfo('故障点位')"><span>故障点位 </span><span> {{ itemData.faultPoint }}</span></li>
      <li @click="showInfo('屏蔽点位')"><span>屏蔽点位 </span><span> {{ itemData.shieldPoint }}</span></li>
    </ul>
    <positionInfo
      v-if="dialogVisible"
      :position-type="positionType"
      :item-data="dataInfo"
      :dialog-visible.sync="dialogVisible"
      @getCancel="handleCancel"
      @closeBindWarnStandard="handleCloseBindWarnStandard"/>
  </div>
</template>
<script>

import link from '@/assets/internetData/link.png'
import breakLink from '@/assets/internetData/breakLink.png'
import firePumpHouse from '@/assets/internetData/firePumpHouse.png'
import position from '@/assets/internetData/position.png'
import time from '@/assets/internetData/time.png'
import positionInfo from './positionInfo.vue'
export default {
  components: {
    positionInfo
  },
  props: {
    itemData: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      link,
      time,
      position,
      firePumpHouse,
      breakLink,
      positionType: '',
      dialogType: '添加',
      dialogVisible: false,
      dataInfo: {}
    }
  },
  computed: {
  },
  created() {
    this.itemData.addr = this.itemData.park_name + '-' + this.itemData.building_name
    this.dataInfo = this.itemData
  },
  methods: {
    showInfo(str) {
      this.positionType = str
      this.dialogVisible = true
    },
    handleCancel() {
      this.dialogVisible = false
    },
    // 关闭弹窗
    handleCloseBindWarnStandard() {
      this.dialogVisible = false
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
#info-strip{
  width:20px;
  height: 192px;
  float: left;
  background-image: linear-gradient(#409EFF, #fff);
}
#info-strip.active{
  background-image: linear-gradient(#f00, #fff);
}
#info-strip.left-strip{
  height: 264px;
}
.item-info{
  width: 310px;
  display: inline-block;
  margin-top: 20px;
  box-sizing: border-box;
  box-shadow:0px 0px 5px 3px rgba(243,243,243,1);
  border: 1px solid rgba(243,243,243,1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  .info-left{
    overflow: hidden;
    width: 190px;
    padding: 5px 10px 25px 10px;
    float: left;
    li{
      height: 40px;
      line-height: 40px;
      color: #373131;
      position: relative;
      padding-left: 24px;
      font-size: 14px;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      i{
        position: absolute;
        display: block;
        background-size: 100%;
        color: #36B4F7;
      }
    }
    .link i{
      width:17px;
      height:8px;
      top: 15px;
      left: 0;
    }
    .breakLink i{
      width:17px;
      height:15px;
      top: 12px;
      left: -1px;
    }
    .time i{
      width:11px;
      height:11px;
      left: 2px;
      top: 14px;
    }
    .position i{
      width:12px;
      height:18px;
      left: 2px;
      top: 10px;
    }
    .firePumpHouse i{
      width:13px;
      height:15px;
      left: 1px;
      top: 12px;
    }
    .name{
      font-weight: bold;
    }
  }
  .other-info{
    float: left;
    padding-left: 0px;
    padding-bottom: 30px;
    li{
      line-height: 14px;
      font-size: 12px;
      color: #fff;
      background:#409EFF;
      border-radius: 8px;
      cursor: pointer;
      margin: 0 10px;
      padding: 6px 10px;
      float:left;
      span{
        display: block;
        text-align: center;
      }
    }
  }
  .info-right{
    width: 90px;
    height: 192px;
    box-sizing: border-box;
    position: absolute;
    left: 210px;
    top: 18px;
    ul{
      overflow: hidden;
    }
    ul i.onActive{
      background: #E8441C;
    }
    ul i.active{
      background: #62B2FB;
    }
    li{
      height: 26px;
      line-height: 26px;
      color: #706262;
      font-size: 12px;
      text-align: left;
      i{
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #49BBC7;
        margin: 0 10px;
      }
    }
  }
}
</style>
